package com.baizhi.test;

import com.baizhi.entity.Category;
import com.baizhi.entity.User;
import com.baizhi.service.BooksService;
import com.baizhi.service.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

@RunWith(SpringRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
public class DFDFSA {
    @Autowired
    private UserService userService;
    @Autowired
    private BooksService booksService;
    @Test
    public void sdsa() {
        User s = userService.selectUser(new User("s", "12"));
        System.out.println(s);
    }

    @Test
    public void update() {
        int deletebook = booksService.deletebook(20);
        System.out.println(deletebook);
        }

    @Test
    public void select() {
        List<Category> categories = booksService.selectAllbook();
            for(Category c: categories) {
                System.err.println(c);
            }
        }
    @Test
    public void login() {
            User s = userService.selectUser(new User("s", "12"));
            System.out.println(s);
        }
    @Test
    public void inster() {
            User s = userService.selectUser(new User("s", "12"));
            System.out.println(s);
        }
}
